# 7-5 自幂数【函数】

def zimiNum():
    def find_armstrong_numbers(n):
        armstrong_numbers = []
        pow_dict = {str(i): i ** n for i in range(10)}
        for i in range(10 ** (n - 1), 10 ** n):
            num_str = str(i)
            total = sum(pow_dict[digit] for digit in num_str)
            if total == i:
                armstrong_numbers.append(i)
        return armstrong_numbers

    n = int(input())
    armstrong_numbers = find_armstrong_numbers(n)
    for number in armstrong_numbers:
        print(number)
zimiNum()